package advertising

import (
	"errors"
	"gitee.com/alex_li/amazon-rpt/internal/rest"
)

func (c *Client) NegativeKeywordA(category string, req []NegativeReq) (err error) {

	resp := make(map[string]NegativeResp)
	r, err := c.request()
	if err != nil {
		return
	}
	action, ok := keyword[category]
	if !ok {
		err = errors.New("category not found")
		return
	}
	err = r.Path(action).Body(req).Expect(207).Response(&resp).Json(rest.POST)
	if err != nil {
		return
	}
	return
}

func (c *Client) NegativeTargetingA(category string, req []NegativeReq) (err error) {
	resp := make(map[string]NegativeResp)
	r, err := c.request()
	if err != nil {
		return
	}
	action, ok := targeting[category]
	if !ok {
		err = errors.New("category not found")
		return
	}
	err = r.Path(action).Body(req).Expect(207).Response(&resp).Json(rest.POST)
	if err != nil {
		return
	}
	return
}
